a variable named as model. The code below shows how to use

puts. Two outputs (model$x and model$y) were used to call

s function to generate a density curve. The result of running the

g code is shown in Figure 2.11.

.24,-1.24,0.74,0.38,1.49,0.19,0.30,

0.99,0.58,-0.46,1.17,-2.89,-2.04,

0.82,0.92,0.91,-0.88,1.06,0.95,0.44,

1.16,-1.12,10.75,4.05,3.23,7.85,

1.56,4.21,9.34,8.05)

density(x)

,nclass=20,prob=TRUE)

model$x,model$y)

g. 2.11. An illustration of using the output of the density function.

he K-nearest neighbour approach

arest neighbour approach estimates a density function for a data

ed on the density of a ball (or a spherical volume) centred at the

t with K nearest neighbours [Bailey and Jain, 1978]. Suppose a

nt is denoted by x and the number of the nearest neighbours is

by K. The K-nearest neighbour approach estimates the density for

int using the following equation, where N is the total number of

ts, d stands for the data dimension and ܸ is the volume of a ball

radius denoted as ܴሺݔሻ,

݂ሺݔሻൌܭ

ܰ

1

ܸܴሺݔሻ

(2.7)